import 'dart:convert';

import 'package:gold/generated/json/base/json_field.dart';
import 'package:gold/generated/json/express_company_model.g.dart';

/// @description:
/// @author tangzhentao
/// @created at 12:24 2025/3/9


@JsonSerializable()
class ExpressCompanyModel {
  @JSONField(name: 'showapi_res_error')
  String? showApiResError;
  @JSONField(name: 'showapi_fee_num')
  int? showApiFeeNum;
  @JSONField(name: 'showapi_res_code')
  int? showApiResCode;
  @JSONField(name: 'showapi_res_id')
  String? showApiResId;
  @JSONField(name: 'showapi_res_body')
  ExpressBody? expressBody;

  ExpressCompanyModel();

  factory ExpressCompanyModel.fromJson(Map<String, dynamic> json) => $ExpressCompanyModelFromJson(json);

  Map<String, dynamic> toJson() => $ExpressCompanyModelToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ExpressBody {
  /// 总数量
  int? allNum;
  /// 每页最大数据
  int? maxSize;
  /// 页码
  int? page;
  /// 成功标识
  bool? flag;
  /// 响应码， code = 0代表成功
  @JSONField(name: 'ret_code')
  int? retCode;
  /// 信息
  String? msg;
  /// 快递公司列表
  @JSONField(name: 'expressList')
  List<Company>? expressList;

  ExpressBody();

  factory ExpressBody.fromJson(Map<String, dynamic> json) => $ExpressBodyFromJson(json);

  Map<String, dynamic> toJson() => $ExpressBodyToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class Company {
  /// 快递公司logo
  String? imgUrl;
  /// 快递公司简写
  String? simpleName;
  /// 快递公司电话
  String? phone;
  /// 快递公司名称
  String? expName;
  /// 官网网址
  String? url;
  /// 快递公司备注
  String? note;

  Company();

  factory Company.fromJson(Map<String, dynamic> json) => $CompanyFromJson(json);

  Map<String, dynamic> toJson() => $CompanyToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}